home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-15 | 1.7 KB | 60 lines | [TEXT/GEOL] |
- Item 2908065 9-June-90 11:39PDT
-
- From: PEMD CH DEV PEMD Group, Zurich,IDV
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Type Casting Problem
-
- Hi Everyone,
-
- In converting a MacApp 1.1.1 application to MacApp 2.0, I've run into a
- bewildering problem in type casting.
-
- A window type is subclassed as follows:
-
- TDiscWindow = OBJECT(TWindow)
- fGrView:TGrView;
- PROCEDURE TDiscWindow.Activate(entering: BOOLEAN);OVERRIDE;
- End; {TDiscWindow}
-
- The window is created from a resource with the following call from
- TDiscDocoument.DoCreateViews:
- aDiscWindow:=TDiscWindow(NewTemplateWindow(kDiscWindowType,SELF));
-
- The resource code is:
-
- resource 'view' (kDiscWindowType, purgeable) { {
- root, 'WIND', { 50, 15 }, { 200, 435 }, sizeVariable, sizeVariable, shown,
- enabled,
- Window {
- "",
- zoomDocProc, goAwayBox, resizable, modeless, ignoreFirstClick,
- freeOnClosing,
- disposeOnFree, DoesntcloseDocument, openWithDocument, dontAdaptToScreen,
- stagger,
- forceOnScreen, dontCenter, NoId, "<<<>>>" };
-
- 'WIND', IncludeViews { kDiscViewType};
- } };
-
- resource 'view' (kDiscViewType, purgeable) { {
- root, 'GRPH', { 0, 0 }, { 200, 435 }, sizeSuperView, sizeSuperView, shown,
- enabled,
- view { "TGrView" };
- } };
-
- All compiles fine. However, evry time NewTemplateWindow is called, the program
- goes into the debugger with "Object type coercion error."
-
- Does anyone have any suggestions. I've tried lots of alternatives with no
- success.
-
- aWindow:=TDiscWindow(NewTemplateWindow(kDiscWindowType,SELF)); works fine where
- aWindow: TWindow. Then aDiscWindow:=TDiscWindow(aWindow); fails with the
- coercion error message.
-
- Thanks,
- Ernie Rosenberg
-
-